#ifndef MARBLE_TEXTURE_HPP
#define MARBLE_TEXTURE_HPP

#include "../common/noiseUntil.hpp"
#include "../math/constants.hpp"
#include "texture.hpp"

class MarbleTexture : public Texture {
public:
  MarbleTexture( f32 stripes_per_unit, f32 s = 5.f, i32 o = 8 ) {
    freq = PI * stripes_per_unit;
    scale = s;
    octaves = o;
    cols[0] = vec3f( 0.6f );
    cols[1] = vec3f( 0.4f, 0.2f, 0.1f );
    cols[2] = vec3f( 0.06f, 0.04f, 0.02f );
    noiseUntil.initPerlinNoise();
  }

  MarbleTexture( const vec3f &c0, const vec3f &c1, const vec3f &c2,
                 f32 stripes_per_unit, f32 s = 3.f, i32 o = 8 ) {
    cols[0] = c0, cols[1] = c1, cols[2] = c2;
    freq = PI * stripes_per_unit;
    scale = s;
    octaves = o;
    noiseUntil.initPerlinNoise();
  }

  vec3f value( const vec2f &uv, const vec3f &p ) const override;

private:
  f32 freq, scale;
  vec3f cols[3];
  i32 octaves;
  NoiseUntil noiseUntil;
};

#endif